// Create a path from objp->pos to the center of end_seg.
// Return a list of (segment_num, point_locations) at psegs
// Return number of points in *num_points.
// if max_depth == -1, then there is no maximum depth.
// If unable to create path, return -1, else return 0.
// If random_flag !0, then introduce randomness into path by looking at sides in random order. This means
// that a path between two segments won't always be the same, unless it is unique.
// If safety_flag is set, then additional points are added to "make sure" that points are reachable. I would
// like to say that it ensures that the object can move between the points, but that would require knowing what
// the object is (which isn't passed, right?) and making fvi calls (slow, right?). So, consider it the more_or_less_safe_flag.
// If end_seg == -2, then end seg will never be found and this routine will drop out due to depth (probably called by create_n_segment_path).
int create_path_points(object *objp, int start_seg, int end_seg, point_seg *psegs, short *num_points, int max_depth, int random_flag, int safety_flag, int avoid_seg)
{
int cur_seg;
int sidenum;
int qtail = 0, qhead = 0;
int i;
byte visited[MAX_SEGMENTS];
seg_seg seg_queue[MAX_SEGMENTS];
short depth[MAX_SEGMENTS];
int cur_depth;
byte random_xlate[MAX_SIDES_PER_SEGMENT];
point_seg *original_psegs = psegs;
#ifndef NDEBUG
point_seg *other_original_psegs = psegs;
#endif
#ifndef NDEBUG
validate_all_paths();
#endif
if ((objp->type == OBJ_ROBOT) && (objp->ctype.ai_info.behavior == AIB_RUN_FROM)) {